import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceLocationVO, DeviceLocationForm, DeviceLocationQuery } from '@/api/authcode/deviceLocation/types';

/**
 * 查询设备位置记录列表
 * @param query
 * @returns {*}
 */

export const listDeviceLocation = (query?: DeviceLocationQuery): AxiosPromise<DeviceLocationVO[]> => {
  return request({
    url: '/authcode/deviceLocation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备位置记录详细
 * @param id
 */
export const getDeviceLocation = (id: string | number): AxiosPromise<DeviceLocationVO> => {
  return request({
    url: '/authcode/deviceLocation/' + id,
    method: 'get'
  });
};

/**
 * 新增设备位置记录
 * @param data
 */
export const addDeviceLocation = (data: DeviceLocationForm) => {
  return request({
    url: '/authcode/deviceLocation',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备位置记录
 * @param data
 */
export const updateDeviceLocation = (data: DeviceLocationForm) => {
  return request({
    url: '/authcode/deviceLocation',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备位置记录
 * @param id
 */
export const delDeviceLocation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/authcode/deviceLocation/' + id,
    method: 'delete'
  });
};
